import puppeteer from "puppeteer-core";
import config from '../config.js';

let browser;

export const launchChrome = async () => {
  browser = await puppeteer.launch({
    executablePath: config.path,
    headless: config.headless,
    devtools: config.devtools,
  });
  return browser;
}


export const getNewPage = async () => {
  const page = await browser.newPage();
  await page.setViewport({width: 375 * 2, height: 667});
  return page;
}

export const closeChrome = async () => {
  await browser.close();
}
